<?php

/**
 * User_Login_model short summary.
 *
 * User_Login_model description.
 *
 * @version 1.0
 * @author GALAXY
 */
class Userlogin_model extends CI_Model
{
    public $user_login_id;
    public $user_login_ip;
    public $user_login_date;
    public $user_id;

    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    public function inset_user_login($user_loginModel)
    {
        return $this->db->insert('user_login',$user_loginModel);
    }

    /**
     * @param mixed $cpage
     * @param mixed $pagesize
     * @param mixed $files
     * @param mixed $tabel
     * @param mixed $order
     */
    public function get_page($cpage,$pagesize,$files,$tabel,$order,$temp_id,$where,$somestr)
    {
        $sql="SELECT $files FROM $tabel a JOIN (select $temp_id from $tabel $where limit ".($cpage-1)*$pagesize.", $pagesize) b ON a.$temp_id = b.$temp_id $somestr";
        $sql_count="select count('$temp_id') as _count from $tabel $where";

        $data['objlist']=$this->db->query($sql)->result();
        $data['count']=$this->db->query($sql_count)->result();
        return $data;
    }

}